//插入排序算法复杂度为n*n

#include <stdio.h>

void Sort(int*a, int n) {
    int i, j, temp;
    for(j=2; j<=n; j++) {
        for(i=j-1; i>0; i--) {
            if(a[i]>=a[i-1])
                break;
            else {
                temp = a[i-1];
                a[i-1] = a[i];
                a[i] = temp;
            }
        }
    }
}

int main()
{
    int a[] = {645,465,468,265,78,135,768,165,165,687};
    Sort(a,sizeof(a)/sizeof(a[0]));
    for(int i=0; i<sizeof(a)/sizeof(a[0]); i++) {
        printf("%d\t",a[i]);
    }
    return 0;
}